package calculator;

public class Operation {

	public int getPriority(String token) {
		if (isPlusMinus(token)) {
			return 1;
		}
		else if (multiplyDivide(token)){ 
			return 2;
		}
		else {
			throw new IllegalArgumentException(token + " no es una operación válida.");
		}
	}

	public boolean isOperation(String token) {
		boolean plusMinus = isPlusMinus(token);
		boolean multiplyDivide = multiplyDivide(token);
		return plusMinus || multiplyDivide;
	}

	public boolean multiplyDivide(String token) {
		return token.equals("/") || token.equals("*");
	}

	public boolean isPlusMinus(String token) {
		return token.equals("+") || token.equals("-");
	}

}
